﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Fis.Service.Rules
{
    public class CustomListProvider : Agile.Engine.View.ProxyViewProvider
    {
        public override System.Collections.Hashtable InitializeViewModel(System.Collections.Hashtable args)
        {
            return new System.Collections.Hashtable();
        }

        public override System.Collections.Hashtable ExecuteQuery(object param)
        {
            var model = (param ?? new System.Collections.Hashtable()) as System.Collections.Hashtable;

            model["action"] = "query";

            if (InvokeService(model))
            {
                model["data"] = (ServiceProcess.Result["data"] == null) ? null : Agile.Engine.Utils.ZipUtils.UnZipDataTable(ServiceProcess.Result["data"].ToString());
            }

            View.Message = ServiceProcess.Message;
            return model;
        }
    }
}
